<template>
	<view class="container" :style="{paddingTop: statusBarHeight + 'px', paddingBottom: bottomSafeAreaHeight + 'px'}">
		<slot></slot>
	</view>
</template>

<script>
	export default {
		name:"container",
		data() {
			return {
				statusBarHeight: 0,
				bottomSafeAreaHeight: 0
			};
		},
		mounted() {
			// 获取系统信息（同步方式，推荐）
			 const systemInfo = uni.getSystemInfoSync();
			 console.log(systemInfo, 'systemInfo')
			 // 状态栏高度（px），苹果设备会自动返回对应机型的正确值
			 const { top, bottom } = systemInfo.safeAreaInsets;
			 this.statusBarHeight = top;
			 this.bottomSafeAreaHeight = bottom;
			 console.log('苹果状态栏高度：', top, bottom); // 例如：44px（iPhone 13系列）、48px（iPhone 14 Pro系列）等
		}
	}
</script>

<style scoped>
.container{
	height: 100vh;
	box-sizing: border-box;
	overflow-y: auto;
	overflow-x: hidden;
}
</style>